/**
 * 工具函数
 */
require('../../fonts/iconfont.css')

function isphone(num){
    return  /^1[3-9]\d{9}$/.test(num)
}
function ispsd(num){
    return  /^[a-zA-Z]\w{5,17}$/.test(num)
}

//封装登录注册弹窗
function toast(icon="√",hint="登录成功"){
 // 创建div
let div=  document.createElement("div")
// let body=  document.createElement("body")
  
  div.className="toast-div"
  div.innerHTML=` 
  <span class="fs28">${icon}</span>
  <p class="mt8">${hint}</p>
 `
  document.body.appendChild(div)

  window.setTimeout(function(){
      div.remove()
  },3000)
}
// 封装底部的导航
 function footerCentent(){
     let div=document.createElement("div")
     let footer=document.querySelector("footer")
     div.className="footer-nav"
     div.innerHTML=`
     <a href="../../index.html">
     <div class="iconfont icon-fangzi"></div>
     <p class="footcolor">首页</p>
     </a>
     <a href="../../sport.html">
     <div class="iconfont icon-jiankang"></div>
     <p class="footcolor">运动</p>
     </a>
     <a href="../../mine.html">
     <div class="iconfont icon-shouye3"></div>
     <p class="footcolor">我的</p>
     </a>
     `
     footer.appendChild(div)
   
 }
 



window.$utils={
    isphone,
    ispsd,
    toast,
    footerCentent,
}